<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
		<button type="button">点击</button>
	</body>
</html>
<script>
	let oBtn = document.querySelector("button");
	
	oBtn.onclick = function(){
		document.cookie = "name=xiaowang";
		document.cookie = "age=18";
		location.href = "4cookieB.html";
	}
</script>